﻿// STATS MODULE
//      Luca Puccini
//      Marco Cornolti
//      Michele Sottile
//      Matteo Parchi

// USER STAS OBJECT

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Stats.Objects
{

    /// <summary>
    /// Represents the User Stats object wich contains user statistic about trips, fuel saved.....
    /// </summary>
    public class UserStats
    {
        /// <summary>
        /// userID
        /// </summary>
        public int UserID { get; set; }

        /// <summary>
        /// Total of km done by user
        /// </summary>
        public double TotalKm { get; set; }

        /// <summary>
        /// Total of fuel saved (Liter) by user
        /// </summary>
        public double TotalFuelSaved { get; set; }

        /// <summary>
        /// Total of money saved (Euro) by user
        /// </summary>
        public double TotalMoneySaved { get; set; }

        /// <summary>
        /// Total of pollution saved by user
        /// </summary>
        public double TotalPollutionSaved { get; set; }

        /// <summary>
        /// Number of trips done as driver by user
        /// </summary>
        public int AsDriverTripsNumber { get; set; }

        /// <summary>
        /// Number of trips done as passenger by user
        /// </summary>
        public int AsPassengerTripsNumber { get; set; }

        /// <summary>
        /// Number of proposed trips by user
        /// </summary>
        public int ProposedTripsNumber;

        /// <summary>
        /// Number of voluntary missed appointments by the user as driver
        /// </summary>
        public int MissedAppointmentsAsDriver { get; set; }

        /// <summary>
        /// Number of voluntary missed appointments by the user as passenger
        /// </summary>
        public int MissedAppointmentsAsPassenger { get; set; }

        /// <summary>
        /// Total of passengers carried by user
        /// </summary>
        public int TotalPassengersCarried { get; set; }

        /// <summary>
        /// Number max passengers carried by user on a single trip
        /// </summary>
        public int MaxPassengersCarried { get; set; }

        /// <summary>
        /// Number of passenger carried on the way in all trips done by the user
        /// </summary>
        public int TotalPassengersCarriedOnTheWay { get; set; }

        /// <summary>
        /// Constructor for a UserStats object with user statistics
        /// </summary>
        /// <param name="uid">User ID</param>
        /// <param name="kmDone">Total of km done</param>
        /// <param name="fuelSaved">Total of fuel saved by the user using TripLOA</param>
        /// <param name="moneySaved">Total of money saved by the user using TripLOA</param>
        /// <param name="pollutionSaved">Total of pollution saved by the user using TripLOA</param>
        /// <param name="tripsDoneAsDRV">Number of trips done as driver</param>
        /// <param name="tripsDoneAsPSN">Number of trips done as passenger</param>
        /// <param name="tripsProposed">Number of proposed trips</param>
        /// <param name="missedAppointmentsAsDRV">Number of user missed appointments ad driver</param>
        /// <param name="missedAppointmentsAsPSN">Number of user missed appointments ad passenger</param>
        /// <param name="totalPsnCarried">Total of passengers carried by user</param>
        /// <param name="maxPSNcarried">Number max of passengers carried by user on a single trip</param>
        /// <param name="psnCarriedOnTheWay">number of passengers carried on the way in all trips done by the user</param>
        /// <example>
        /// <code>
        /// UserStats usSt = new UserStats("Mark81",5000,100,136,(1.32),8,12,15,4,23,4,500);
        /// </code>
        /// </example> 
        public UserStats (int uid, double kmDone, double fuelSaved, double moneySaved, double pollutionSaved, int tripsDoneAsDRV, int tripsDoneAsPSN,
            int tripsProposed, int missedAppointmentsAsDRV, int missedAppointmentsAsPSN, int totalPsnCarried, int maxPSNcarried, int psnCarriedOnTheWay)
        
        {
            UserID = uid;
            TotalKm = kmDone;
            TotalFuelSaved = fuelSaved;
            TotalMoneySaved = moneySaved;
            TotalPollutionSaved = pollutionSaved;
            AsDriverTripsNumber = tripsDoneAsDRV;
            AsPassengerTripsNumber = tripsDoneAsPSN;
            ProposedTripsNumber = tripsProposed;
            MissedAppointmentsAsDriver = missedAppointmentsAsDRV;
            MissedAppointmentsAsPassenger = missedAppointmentsAsPSN;
            TotalPassengersCarried = totalPsnCarried;
            MaxPassengersCarried = maxPSNcarried;
            TotalPassengersCarriedOnTheWay = psnCarriedOnTheWay;
            
        }

        ///<summary> 
        ///Gets number of user handshaked trips 
        ///</summary>
        ///<returns>int</returns>
        public int HandshakedTripsNumber
        {
            get {return AsDriverTripsNumber + AsPassengerTripsNumber;}
        }

    }
}
